package com.zxx.flowerstore.utils.common;

import com.zxx.flowerstore.entity.enums.ResultEnum;

/**
 * @ClassName MyException
 * @Author Admin
 * @Date 2021/3/15 22:17
 * @Description MyException
 * @Version 1.0
 */
public class MyException extends RuntimeException {
    private Integer code;
    private String  message;

    public MyException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public MyException(ResultEnum resultEnum) {
        this(resultEnum.getCode(), resultEnum.getMsg());
    }

    public MyException(String message) {
        this(ResultEnum.ERROR.getCode(), message);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
